\hypertarget{picocoap_8c}{}\doxysection{picocoap.\+c File Reference}
\label{picocoap_8c}\index{picocoap.c@{picocoap.c}}
{\ttfamily \#include $<$stddef.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include \char`\"{}picocoap.\+h\char`\"{}}\newline
{\ttfamily \#include \char`\"{}schc.\+h\char`\"{}}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
uint8\+\_\+t \mbox{\hyperlink{picocoap_8c_acbfc392c98f18ba088cacabd5cc82ce0}{pcoap\+\_\+get\+\_\+coap\+\_\+offset}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu)
\begin{DoxyCompactList}\small\item\em Finds the length of the Co\+AP header. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_aafb365b66f2b8cd7fc93b6b83dce56fa}{pcoap\+\_\+validate\+\_\+pkt}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu)
\begin{DoxyCompactList}\small\item\em Validate Packet. \end{DoxyCompactList}\item 
uint8\+\_\+t \mbox{\hyperlink{picocoap_8c_a9d1aa7c8f685736b6f58cb09f40bdd3c}{pcoap\+\_\+get\+\_\+token}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, uint8\+\_\+t $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Get Message Token. \end{DoxyCompactList}\item 
\mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} \mbox{\hyperlink{picocoap_8c_a859e8eba609867e6e2c0b6ff2a969d38}{pcoap\+\_\+get\+\_\+option}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, \mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} $\ast$last)
\begin{DoxyCompactList}\small\item\em Get Option. \end{DoxyCompactList}\item 
\mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} \mbox{\hyperlink{picocoap_8c_a28b0035cf1fab512f4a990059e78501b}{pcoap\+\_\+get\+\_\+option\+\_\+by\+\_\+num}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, \mbox{\hyperlink{picocoap_8h_a07242620cf4343b2a2b3b9e085c8bfc5}{pcoap\+\_\+option\+\_\+number}} num, uint8\+\_\+t occ)
\begin{DoxyCompactList}\small\item\em Get Option by Option Number. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a8aad0dae8087fa65cd0f77951ccf6fe0}{pcoap\+\_\+decode\+\_\+option}} (uint8\+\_\+t $\ast$pkt\+\_\+ptr, size\+\_\+t pkt\+\_\+len, uint16\+\_\+t $\ast$option\+\_\+number, size\+\_\+t $\ast$option\+\_\+length, uint8\+\_\+t $\ast$$\ast$value)
\begin{DoxyCompactList}\small\item\em Internal Method. \end{DoxyCompactList}\item 
\mbox{\hyperlink{structpcoap__payload}{pcoap\+\_\+payload}} \mbox{\hyperlink{picocoap_8c_af576d82c1b5c6b38db85c4b38691fc87}{pcoap\+\_\+get\+\_\+payload}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu)
\begin{DoxyCompactList}\small\item\em Get Option. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a498bfe6e2730cb5018c43e1c84ece8b8}{pcoap\+\_\+init\+\_\+pdu}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu)
\begin{DoxyCompactList}\small\item\em Initialize Packet. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a3e568b4f75937495e103d3e0c4a562e2}{pcoap\+\_\+set\+\_\+version}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, \mbox{\hyperlink{picocoap_8h_aa85087040a9a41e7c24d8ae00f24e02b}{pcoap\+\_\+version}} ver)
\begin{DoxyCompactList}\small\item\em Set Version. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a6cd830e991279e45ed6bba30f66ff5fe}{pcoap\+\_\+set\+\_\+type}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, \mbox{\hyperlink{picocoap_8h_ac67fe50885918b21eee276d621605942}{pcoap\+\_\+type}} mtype)
\begin{DoxyCompactList}\small\item\em Set Message Type. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a97706747324f6ab07b054ced91de43a5}{pcoap\+\_\+set\+\_\+code}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, \mbox{\hyperlink{picocoap_8h_a38d6e34ee134b30dc8e0ff2645bdefc8}{pcoap\+\_\+code}} code)
\begin{DoxyCompactList}\small\item\em Set Message Code. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a8b2807c0af83004f3144d8b295fec647}{pcoap\+\_\+set\+\_\+mid}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, uint16\+\_\+t mid)
\begin{DoxyCompactList}\small\item\em Set Message ID. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a5b9a5b44c21a9764790c1a7f3168f5bc}{pcoap\+\_\+set\+\_\+token}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, uint8\+\_\+t $\ast$token, uint8\+\_\+t tkl)
\begin{DoxyCompactList}\small\item\em Set Message Token. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a539c085f5cd8660309b9248fe2224c9c}{pcoap\+\_\+add\+\_\+option}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, int32\+\_\+t opt\+\_\+num, uint8\+\_\+t $\ast$value, uint16\+\_\+t opt\+\_\+len)
\begin{DoxyCompactList}\small\item\em Add Message Option. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_a314a687de17c9e5c0325e2842d4899dc}{pcoap\+\_\+set\+\_\+payload}} (\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$pdu, uint8\+\_\+t $\ast$payload, size\+\_\+t payload\+\_\+len)
\begin{DoxyCompactList}\small\item\em Add Message Option. \end{DoxyCompactList}\item 
\mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} \mbox{\hyperlink{picocoap_8c_af3fd3d8aafe1d09a4a17ae97c44e2548}{pcoap\+\_\+adjust\+\_\+option\+\_\+deltas}} (uint8\+\_\+t $\ast$opts\+\_\+start, size\+\_\+t $\ast$opts\+\_\+len, size\+\_\+t max\+\_\+len, int32\+\_\+t offset)
\begin{DoxyCompactList}\small\item\em Internal Method. \end{DoxyCompactList}\item 
int8\+\_\+t \mbox{\hyperlink{picocoap_8c_a6ed0e923c8bde1711a858f6a95d6211d}{pcoap\+\_\+build\+\_\+option\+\_\+header}} (uint8\+\_\+t $\ast$buf, size\+\_\+t max\+\_\+len, int32\+\_\+t opt\+\_\+delta, int32\+\_\+t opt\+\_\+len)
\begin{DoxyCompactList}\small\item\em Internal Method. \end{DoxyCompactList}\item 
int8\+\_\+t \mbox{\hyperlink{picocoap_8c_ae623c60b0b9c8e994b3fd7687eee0147}{pcoap\+\_\+compute\+\_\+option\+\_\+header\+\_\+len}} (int32\+\_\+t opt\+\_\+delta, int32\+\_\+t opt\+\_\+len)
\begin{DoxyCompactList}\small\item\em Internal Method. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{picocoap_8c_a539c085f5cd8660309b9248fe2224c9c}\label{picocoap_8c_a539c085f5cd8660309b9248fe2224c9c}} 
\index{picocoap.c@{picocoap.c}!pcoap\_add\_option@{pcoap\_add\_option}}
\index{pcoap\_add\_option@{pcoap\_add\_option}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_add\_option()}{pcoap\_add\_option()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+add\+\_\+option (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{int32\+\_\+t}]{opt\+\_\+num,  }\item[{uint8\+\_\+t $\ast$}]{value,  }\item[{uint16\+\_\+t}]{opt\+\_\+len }\end{DoxyParamCaption})}



Add Message Option. 

Adds an option to the existing message. Options S\+H\+O\+U\+LD be added in order of option number. In the case of multiple options of the same type, they are sorted in the order that they are added. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em opt} & option container. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_af3fd3d8aafe1d09a4a17ae97c44e2548}\label{picocoap_8c_af3fd3d8aafe1d09a4a17ae97c44e2548}} 
\index{picocoap.c@{picocoap.c}!pcoap\_adjust\_option\_deltas@{pcoap\_adjust\_option\_deltas}}
\index{pcoap\_adjust\_option\_deltas@{pcoap\_adjust\_option\_deltas}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_adjust\_option\_deltas()}{pcoap\_adjust\_option\_deltas()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+adjust\+\_\+option\+\_\+deltas (\begin{DoxyParamCaption}\item[{uint8\+\_\+t $\ast$}]{opts\+\_\+start,  }\item[{size\+\_\+t $\ast$}]{opts\+\_\+len,  }\item[{size\+\_\+t}]{max\+\_\+len,  }\item[{int32\+\_\+t}]{offset }\end{DoxyParamCaption})}



Internal Method. 

\mbox{\Hypertarget{picocoap_8c_a6ed0e923c8bde1711a858f6a95d6211d}\label{picocoap_8c_a6ed0e923c8bde1711a858f6a95d6211d}} 
\index{picocoap.c@{picocoap.c}!pcoap\_build\_option\_header@{pcoap\_build\_option\_header}}
\index{pcoap\_build\_option\_header@{pcoap\_build\_option\_header}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_build\_option\_header()}{pcoap\_build\_option\_header()}}
{\footnotesize\ttfamily int8\+\_\+t pcoap\+\_\+build\+\_\+option\+\_\+header (\begin{DoxyParamCaption}\item[{uint8\+\_\+t $\ast$}]{buf,  }\item[{size\+\_\+t}]{max\+\_\+len,  }\item[{int32\+\_\+t}]{opt\+\_\+delta,  }\item[{int32\+\_\+t}]{opt\+\_\+len }\end{DoxyParamCaption})}



Internal Method. 

\mbox{\Hypertarget{picocoap_8c_ae623c60b0b9c8e994b3fd7687eee0147}\label{picocoap_8c_ae623c60b0b9c8e994b3fd7687eee0147}} 
\index{picocoap.c@{picocoap.c}!pcoap\_compute\_option\_header\_len@{pcoap\_compute\_option\_header\_len}}
\index{pcoap\_compute\_option\_header\_len@{pcoap\_compute\_option\_header\_len}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_compute\_option\_header\_len()}{pcoap\_compute\_option\_header\_len()}}
{\footnotesize\ttfamily int8\+\_\+t pcoap\+\_\+compute\+\_\+option\+\_\+header\+\_\+len (\begin{DoxyParamCaption}\item[{int32\+\_\+t}]{opt\+\_\+delta,  }\item[{int32\+\_\+t}]{opt\+\_\+len }\end{DoxyParamCaption})}



Internal Method. 

\mbox{\Hypertarget{picocoap_8c_a8aad0dae8087fa65cd0f77951ccf6fe0}\label{picocoap_8c_a8aad0dae8087fa65cd0f77951ccf6fe0}} 
\index{picocoap.c@{picocoap.c}!pcoap\_decode\_option@{pcoap\_decode\_option}}
\index{pcoap\_decode\_option@{pcoap\_decode\_option}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_decode\_option()}{pcoap\_decode\_option()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+decode\+\_\+option (\begin{DoxyParamCaption}\item[{uint8\+\_\+t $\ast$}]{pkt\+\_\+ptr,  }\item[{size\+\_\+t}]{pkt\+\_\+len,  }\item[{uint16\+\_\+t $\ast$}]{option\+\_\+number,  }\item[{size\+\_\+t $\ast$}]{option\+\_\+length,  }\item[{uint8\+\_\+t $\ast$$\ast$}]{value }\end{DoxyParamCaption})}



Internal Method. 

\mbox{\Hypertarget{picocoap_8c_acbfc392c98f18ba088cacabd5cc82ce0}\label{picocoap_8c_acbfc392c98f18ba088cacabd5cc82ce0}} 
\index{picocoap.c@{picocoap.c}!pcoap\_get\_coap\_offset@{pcoap\_get\_coap\_offset}}
\index{pcoap\_get\_coap\_offset@{pcoap\_get\_coap\_offset}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_get\_coap\_offset()}{pcoap\_get\_coap\_offset()}}
{\footnotesize\ttfamily uint8\+\_\+t pcoap\+\_\+get\+\_\+coap\+\_\+offset (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu }\end{DoxyParamCaption})}



Finds the length of the Co\+AP header. 


\begin{DoxyParams}{Parameters}
{\em pdu} & the Co\+AP pdu, containing the header and payload\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the length of the Co\+AP header 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a859e8eba609867e6e2c0b6ff2a969d38}\label{picocoap_8c_a859e8eba609867e6e2c0b6ff2a969d38}} 
\index{picocoap.c@{picocoap.c}!pcoap\_get\_option@{pcoap\_get\_option}}
\index{pcoap\_get\_option@{pcoap\_get\_option}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_get\_option()}{pcoap\_get\_option()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} pcoap\+\_\+get\+\_\+option (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{\mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} $\ast$}]{last }\end{DoxyParamCaption})}



Get Option. 

Iterates over the options in the given message. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in,out}}  & {\em pointer} & to the last/next option, pass 0 for the first option. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+option 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a28b0035cf1fab512f4a990059e78501b}\label{picocoap_8c_a28b0035cf1fab512f4a990059e78501b}} 
\index{picocoap.c@{picocoap.c}!pcoap\_get\_option\_by\_num@{pcoap\_get\_option\_by\_num}}
\index{pcoap\_get\_option\_by\_num@{pcoap\_get\_option\_by\_num}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_get\_option\_by\_num()}{pcoap\_get\_option\_by\_num()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structpcoap__option}{pcoap\+\_\+option}} pcoap\+\_\+get\+\_\+option\+\_\+by\+\_\+num (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{\mbox{\hyperlink{picocoap_8h_a07242620cf4343b2a2b3b9e085c8bfc5}{pcoap\+\_\+option\+\_\+number}}}]{num,  }\item[{uint8\+\_\+t}]{occ }\end{DoxyParamCaption})}



Get Option by Option Number. 

Gets a single specified by the option number and index of which occurrence of that option number you\textquotesingle{}d like. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em num} & option number to get. \\
\hline
\mbox{\texttt{ in}}  & {\em occ} & occurrence of to get (0th, 1st, 2nd, etc) 0 for the first option. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+option 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_af576d82c1b5c6b38db85c4b38691fc87}\label{picocoap_8c_af576d82c1b5c6b38db85c4b38691fc87}} 
\index{picocoap.c@{picocoap.c}!pcoap\_get\_payload@{pcoap\_get\_payload}}
\index{pcoap\_get\_payload@{pcoap\_get\_payload}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_get\_payload()}{pcoap\_get\_payload()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structpcoap__payload}{pcoap\+\_\+payload}} pcoap\+\_\+get\+\_\+payload (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu }\end{DoxyParamCaption})}



Get Option. 

Extracts the option with the given index in the given message. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+payload 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a9d1aa7c8f685736b6f58cb09f40bdd3c}\label{picocoap_8c_a9d1aa7c8f685736b6f58cb09f40bdd3c}} 
\index{picocoap.c@{picocoap.c}!pcoap\_get\_token@{pcoap\_get\_token}}
\index{pcoap\_get\_token@{pcoap\_get\_token}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_get\_token()}{pcoap\_get\_token()}}
{\footnotesize\ttfamily uint8\+\_\+t pcoap\+\_\+get\+\_\+token (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{uint8\+\_\+t $\ast$}]{ptr }\end{DoxyParamCaption})}



Get Message Token. 

Extracts the token from the given message. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
token. 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a498bfe6e2730cb5018c43e1c84ece8b8}\label{picocoap_8c_a498bfe6e2730cb5018c43e1c84ece8b8}} 
\index{picocoap.c@{picocoap.c}!pcoap\_init\_pdu@{pcoap\_init\_pdu}}
\index{pcoap\_init\_pdu@{pcoap\_init\_pdu}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_init\_pdu()}{pcoap\_init\_pdu()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+init\+\_\+pdu (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu }\end{DoxyParamCaption})}



Initialize Packet. 

Initializes on an empty buffer for creating new Co\+AP packets. This function (or coap\+\_\+validate for parsing packets) must be called and must return C\+E\+\_\+\+N\+O\+NE before you can use any of the getters or setter. The packet is initialized to a Co\+AP Ping. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a97706747324f6ab07b054ced91de43a5}\label{picocoap_8c_a97706747324f6ab07b054ced91de43a5}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_code@{pcoap\_set\_code}}
\index{pcoap\_set\_code@{pcoap\_set\_code}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_code()}{pcoap\_set\_code()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+code (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{\mbox{\hyperlink{picocoap_8h_a38d6e34ee134b30dc8e0ff2645bdefc8}{pcoap\+\_\+code}}}]{code }\end{DoxyParamCaption})}



Set Message Code. 

Sets the message type header field. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em code} & code to set. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
coap\+\_\+code 
\end{DoxySeeAlso}
\mbox{\Hypertarget{picocoap_8c_a8b2807c0af83004f3144d8b295fec647}\label{picocoap_8c_a8b2807c0af83004f3144d8b295fec647}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_mid@{pcoap\_set\_mid}}
\index{pcoap\_set\_mid@{pcoap\_set\_mid}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_mid()}{pcoap\_set\_mid()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+mid (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{uint16\+\_\+t}]{mid }\end{DoxyParamCaption})}



Set Message ID. 

Sets the message ID header field. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em mid} & message ID to set. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a314a687de17c9e5c0325e2842d4899dc}\label{picocoap_8c_a314a687de17c9e5c0325e2842d4899dc}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_payload@{pcoap\_set\_payload}}
\index{pcoap\_set\_payload@{pcoap\_set\_payload}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_payload()}{pcoap\_set\_payload()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+payload (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{uint8\+\_\+t $\ast$}]{payload,  }\item[{size\+\_\+t}]{payload\+\_\+len }\end{DoxyParamCaption})}



Add Message Option. 

Sets the payload of the given message to the value in {\ttfamily payload}. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em pl} & payload container. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a5b9a5b44c21a9764790c1a7f3168f5bc}\label{picocoap_8c_a5b9a5b44c21a9764790c1a7f3168f5bc}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_token@{pcoap\_set\_token}}
\index{pcoap\_set\_token@{pcoap\_set\_token}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_token()}{pcoap\_set\_token()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+token (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{uint8\+\_\+t $\ast$}]{token,  }\item[{uint8\+\_\+t}]{tkl }\end{DoxyParamCaption})}



Set Message Token. 

Sets the message token header field. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em token} & pointer to the token array to set. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\mbox{\Hypertarget{picocoap_8c_a6cd830e991279e45ed6bba30f66ff5fe}\label{picocoap_8c_a6cd830e991279e45ed6bba30f66ff5fe}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_type@{pcoap\_set\_type}}
\index{pcoap\_set\_type@{pcoap\_set\_type}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_type()}{pcoap\_set\_type()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+type (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{\mbox{\hyperlink{picocoap_8h_ac67fe50885918b21eee276d621605942}{pcoap\+\_\+type}}}]{mtype }\end{DoxyParamCaption})}



Set Message Type. 

Sets the message type header field. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em mtype} & type to set. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{picocoap_8h_a5022bbbae08abe01dc1e3363d01c9429}{coap\+\_\+type}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{picocoap_8c_a3e568b4f75937495e103d3e0c4a562e2}\label{picocoap_8c_a3e568b4f75937495e103d3e0c4a562e2}} 
\index{picocoap.c@{picocoap.c}!pcoap\_set\_version@{pcoap\_set\_version}}
\index{pcoap\_set\_version@{pcoap\_set\_version}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_set\_version()}{pcoap\_set\_version()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+set\+\_\+version (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu,  }\item[{\mbox{\hyperlink{picocoap_8h_aa85087040a9a41e7c24d8ae00f24e02b}{pcoap\+\_\+version}}}]{ver }\end{DoxyParamCaption})}



Set Version. 

Sets the version number header field. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\mbox{\texttt{ in}}  & {\em ver} & version to set. Must be C\+O\+A\+P\+\_\+\+V1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
coap\+\_\+error (0 == no error) 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{picocoap_8h_a68aad811c8ab03701a2c3f1b84debe74}{coap\+\_\+version}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{picocoap_8c_aafb365b66f2b8cd7fc93b6b83dce56fa}\label{picocoap_8c_aafb365b66f2b8cd7fc93b6b83dce56fa}} 
\index{picocoap.c@{picocoap.c}!pcoap\_validate\_pkt@{pcoap\_validate\_pkt}}
\index{pcoap\_validate\_pkt@{pcoap\_validate\_pkt}!picocoap.c@{picocoap.c}}
\doxysubsubsection{\texorpdfstring{pcoap\_validate\_pkt()}{pcoap\_validate\_pkt()}}
{\footnotesize\ttfamily \mbox{\hyperlink{picocoap_8h_a4ae82558a4b549c2ae73f851df0d6cb2}{pcoap\+\_\+error}} pcoap\+\_\+validate\+\_\+pkt (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structpcoap__pdu}{pcoap\+\_\+pdu}} $\ast$}]{pdu }\end{DoxyParamCaption})}



Validate Packet. 

Parses the given packet to check if it is a valid Co\+AP message. This function (or coap\+\_\+init\+\_\+pdu for creating new packets) must be called and must return C\+E\+\_\+\+N\+O\+NE before you can use any of the getters or setter. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em pdu} & pointer to the coap message struct. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
error code (C\+E\+\_\+\+N\+O\+NE == 0 == no error). 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{picocoap_8h_aa9dd43046c8daad008c9195a6f84d4f1}{coap\+\_\+error}} 

coap\+\_\+init\+\_\+pdu 
\end{DoxySeeAlso}
